package cn.com.ylg.yang_lbs_20170301;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.MapView;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by MyPC on 2017/3/1.
 */

public class MapTypeActivity extends AppCompatActivity {
    @Bind(R.id.putong)
    TextView putong;
    @Bind(R.id.weixing)
    TextView weixing;
    @Bind(R.id.kongbai)
    TextView kongbai;
    @Bind(R.id.bmapView)
    MapView mMapView;

    private BaiduMap mBaiduMap;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_type);
        ButterKnife.bind(this);
        mBaiduMap = mMapView.getMap();
        }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        // 在activity执行onDestroy时执行mMapView.onDestroy()，实现地图生命周期管理
        mMapView.onDestroy();
    }

    @Override
    protected void onResume() {
        super.onResume();
        // 在activity执行onResume时执行mMapView. onResume ()，实现地图生命周期管理
        mMapView.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        // 在activity执行onPause时执行mMapView. onPause ()，实现地图生命周期管理
        mMapView.onPause();
    }
    @OnClick({R.id.putong, R.id.weixing, R.id.kongbai})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.putong:
                mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
                break;
            case R.id.weixing:
                mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);
                break;
            case R.id.kongbai:
                mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NONE);
                break;
        }
    }


}
